package com.liuheng.manager.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liuheng.manager.mapper.CategoryBrandMapper;
import com.liuheng.manager.mapper.CategoryMapper;
import com.liuheng.manager.service.CategoryBrandService;
import com.liuheng.manager.service.CategoryService;
import com.liuheng.spzx.model.dto.product.CategoryBrandDto;
import com.liuheng.spzx.model.entity.product.Brand;
import com.liuheng.spzx.model.entity.product.CategoryBrand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryBrandServiceImpl extends ServiceImpl<CategoryBrandMapper, CategoryBrand> implements CategoryBrandService {
    @Autowired
    private CategoryBrandMapper categoryBrandMapper;
    @Override
    public Page<CategoryBrand> findByPage(int page, int limit, CategoryBrandDto categoryBrandDto) {
        Page<CategoryBrand> page1 = new Page<>(page, limit);
        List<CategoryBrand> categoryBrandList=categoryBrandMapper.findByPage(page1,categoryBrandDto);
        page1.setRecords(categoryBrandList);
        return page1;
    }

    @Override
    public List<Brand> findBrandByCategoryId(Long categoryId) {
        List<Brand> list=categoryBrandMapper.findBrandByCategoryId(categoryId);
        return list;
    }
}
